<select id="gallery_page_id" name="gallery[page_id]" style="width:385px;">
    <option></option>
    <?php foreach ($pages as $page):?>
        <option <?php if ($selected_id == $page->getId()) echo 'selected';?> value="<?php echo $page->getId()?>"><?php echo $page?></option>
    <?php endforeach?>
</select>